#include <stdio.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

uint8_t code[] = {
	0x3f,/*0*/
	0x06,/*1*/
	0x5b,/*2*/
	0x4f,/*3*/
	0x66,/*4*/
	0x6d,/*5*/
	0x7d,/*6*/
	0x07,/*7*/
	0x7f,/*8*/
	0x6f /*9*/
};

int main()
{
	uint8_t poscode[2];
	int fd = open("/dev/digit4", O_WRONLY);
	if (!fd)
	{
		perror("open");
		return 1;
	}

	for (int i = 0; i <= 9; i++)
	{
		poscode[0] = 0xff;
		poscode[1] = code[i];

		write(fd, &poscode, sizeof(poscode));
		sleep(1);
	}

	close(fd);
	return 0;
}
